Tab character is substituted by one blank character Arguments: string String to be processed Result: processed string
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*) | :: | string |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public, | parameter | :: | IACHAR_space | = | 32 |
Definitions of a space character in the ASCII collating sequence |
integer, | public, | parameter | :: | IACHAR_tab | = | 9 |
Definitions of a tab character in the |
integer(kind=short), | public | :: | i | ||||
integer, | public | :: | iachar_character |
FUNCTION TabToSpace & ( string ) & RESULT (out) IMPLICIT NONE ! Function arguments ! Scalar arguments with intent(in): CHARACTER(LEN=*) :: string ! Local scalars: CHARACTER(LEN=LEN(string)) :: out INTEGER (KIND = short) :: i INTEGER, PARAMETER :: IACHAR_tab = 9 !! Definitions of a tab character in the !! ASCII collating sequence INTEGER, PARAMETER :: IACHAR_space = 32 !! Definitions of a space character !! in the ASCII collating sequence INTEGER :: iachar_character !------------end of declaration------------------------------------------------ !Loop over string elements DO i = 1, LEN (string) ! Convert the current character to its position ! in the ASCII collating sequence iachar_character = IACHAR( string( i:i ) ) IF ( iachar_character == IACHAR_TAB ) THEN out( i:i ) = ACHAR ( IACHAR_space ) ELSE out( i:i ) = string( i:i ) END IF END DO RETURN END FUNCTION TabToSpace